package com.csi.jf.crucible.common.service.impl;

import java.util.HashMap;
import java.util.Map;

import com.chinasofti.ro.bizframework.core.orm.IDAO;
import com.csi.jf.crucible.common.model.JfTUser;
import com.csi.jf.crucible.common.service.LoginService;

/**
 * <p>Service Impl</p>
 * 
 * @author BizFoundation
 * @version 5.0
 * @since 1.0
 */
public class LoginServiceImpl implements LoginService {
	private IDAO dao;
	
	public void setDao(IDAO dao) {
		this.dao = dao;
	}

	@Override
	public JfTUser ifLogin(String username, String password) {
	 	String sql = "select * from jf_pts_user where User_Name = :username and User_Password = :password ";
	 	Map<String,String> params = new HashMap<String,String>();
	 	params.put("username",username);
	 	params.put("password",password);
	 	JfTUser u = (JfTUser)dao.createNamedQuery(JfTUser.class,sql,params).first(); 		
	 	return u;
	}

}